<HTML>
    <HEAD>
        <TITLE>Genesys Team Report ver 2.0. (c)Pavel Usim</TITLE>
        <link rel="stylesheet" type="text/css" href="..\def.css" />
    </HEAD>
    <BODY>
        <img align ="right" alt ="Genesys" src="..\img\GenesysLogo.png">
        <p align="center"><a name="top">Genesys Team Report. ver 2.0</a><img src="..\img\beta.gif" alt="beta">
            <br>Admin interface.</p>
        <?php
//recreate the db

        require '../dbconnect.php';

        mysql_query('DROP TABLE srs');
        mysql_query('CREATE TABLE srs (sr MEDIUMINT UNSIGNED NOT NULL, escalation_flag ENUM(\'N\',\'Y\'),closed INT UNSIGNED, opened INT UNSIGNED NOT NULL, priority ENUM(\'1\',\'2\',\'3\',\'4\'), owner SMALLINT UNSIGNED, status SMALLINT UNSIGNED NOT NULL, sub_status SMALLINT UNSIGNED NOT NULL, tier_t_owner SMALLINT UNSIGNED, last_public INT UNSIGNED, modified INT UNSIGNED NOT NULL, sold_to_account SMALLINT UNSIGNED NOT NULL, end_user_account SMALLINT UNSIGNED NOT NULL, owner_support_group SMALLINT UNSIGNED, end_user_support_group SMALLINT UNSIGNED NOT NULL, product SMALLINT UNSIGNED, product_line SMALLINT UNSIGNED, sub_area SMALLINT UNSIGNED, version varchar(15), production_down  ENUM(\'N\',\'Y\'), os SMALLINT UNSIGNED, switch SMALLINT UNSIGNED, dbms SMALLINT UNSIGNED, linktype SMALLINT UNSIGNED, training_flag ENUM(\'N\',\'Y\'), resolution_code SMALLINT UNSIGNED, customer SMALLINT UNSIGNED, rca ENUM(\'N\',\'Y\'), techlead ENUM(\'N\',\'Y\'), PRIMARY KEY (sr))');

        mysql_query('DROP TABLE tse');
        mysql_query('CREATE TABLE tse (owner_id SMALLINT UNSIGNED NOT NULL AUTO_INCREMENT,tse_name varchar(30) NOT NULL, team char(3) NOT NULL, email varchar(30), INDEX (owner_id), PRIMARY KEY (owner_id));');

        mysql_query('DROP TABLE customer;');
        mysql_query('CREATE TABLE customer(id smallint unsigned not null auto_increment, val varchar(64) NOT NULL, PRIMARY KEY (id), INDEX (id))');

        mysql_query('DROP TABLE srstatus;');
        mysql_query('CREATE TABLE srstatus(id smallint unsigned not null auto_increment, val varchar(64) NOT NULL, PRIMARY KEY (id), INDEX (id))');

        mysql_query('DROP TABLE srsubstatus;');
        mysql_query('CREATE TABLE srsubstatus(id smallint unsigned not null auto_increment, val varchar(64) NOT NULL, PRIMARY KEY (id), INDEX (id))');

        mysql_query('DROP TABLE staccount;');
        mysql_query('CREATE TABLE staccount(id smallint unsigned not null auto_increment, val varchar(64) NOT NULL, PRIMARY KEY (id), INDEX (id))');

        mysql_query('DROP TABLE euaccount;');
        mysql_query('CREATE TABLE euaccount(id smallint unsigned not null auto_increment, val varchar(64) NOT NULL, PRIMARY KEY (id), INDEX (id))');

        mysql_query('DROP TABLE resolcode;');
        mysql_query('CREATE TABLE resolcode(id smallint unsigned not null auto_increment, val varchar(64) NOT NULL, PRIMARY KEY (id), INDEX (id))');

        mysql_query('DROP TABLE link;');
        mysql_query('CREATE TABLE link(id smallint unsigned not null auto_increment, val varchar(64) NOT NULL, PRIMARY KEY (id), INDEX (id))');

        mysql_query('DROP TABLE switch;');
        mysql_query('CREATE TABLE switch(id smallint unsigned not null auto_increment, val varchar(64) NOT NULL, PRIMARY KEY (id), INDEX (id))');

        mysql_query('DROP TABLE os;');
        mysql_query('CREATE TABLE os(id smallint unsigned not null auto_increment, val varchar(64) NOT NULL, PRIMARY KEY (id), INDEX (id))');

        mysql_query('DROP TABLE dbms;');
        mysql_query('CREATE TABLE dbms(id smallint unsigned not null auto_increment, val varchar(64) NOT NULL, PRIMARY KEY (id), INDEX (id))');

        mysql_query('DROP TABLE product;');
        mysql_query('CREATE TABLE product(id smallint unsigned not null auto_increment, val varchar(64) NOT NULL, PRIMARY KEY (id), INDEX (id))');

        mysql_query('DROP TABLE productline;');
        mysql_query('CREATE TABLE productline(id smallint unsigned not null auto_increment, val varchar(64) NOT NULL, PRIMARY KEY (id), INDEX (id))');

        mysql_query('DROP TABLE subarea;');
        mysql_query('CREATE TABLE subarea(id smallint unsigned not null auto_increment, val varchar(128) NOT NULL, PRIMARY KEY (id), INDEX (id))');

        mysql_query('DROP TABLE supportgroup;');
        mysql_query('CREATE TABLE supportgroup(id smallint unsigned not null auto_increment, val varchar(64) NOT NULL, PRIMARY KEY (id), INDEX (id))');

        mysql_query('DROP TABLE custregion;');
        mysql_query('CREATE TABLE custregion(id smallint unsigned not null auto_increment, val varchar(64) NOT NULL, PRIMARY KEY (id), INDEX (id))');

// kcs docs
        mysql_query('DROP TABLE kcs;');
        mysql_query('CREATE TABLE kcs(doc_id varchar(15) NOT NULL, sr MEDIUMINT UNSIGNED NOT NULL, linked_by SMALLINT UNSIGNED NOT NULL, linked_date INT UNSIGNED NOT NULL, updated_date INT UNSIGNED NOT NULL, usefulness ENUM(\'Y\',\'N\'), type ENUM(\'S\',\'D\',\'R\'), PRIMARY KEY (doc_id, sr),INDEX (doc_id, sr))');

//Customer Satisfaction
        mysql_query('DROP TABLE custsat;');
        mysql_query('CREATE TABLE custsat(sr MEDIUMINT UNSIGNED NOT NULL, sr_owner SMALLINT UNSIGNED NOT NULL, survey_date INT UNSIGNED NOT NULL, skill ENUM(\'1\',\'2\',\'3\',\'4\',\'5\') NOT NULL, advised ENUM(\'1\',\'2\',\'3\',\'4\',\'5\') NOT NULL, professional ENUM(\'1\',\'2\',\'3\',\'4\',\'5\'), time ENUM(\'1\',\'2\',\'3\',\'4\',\'5\') NOT NULL, efect ENUM(\'1\',\'2\',\'3\',\'4\',\'5\'), overall ENUM(\'1\',\'2\',\'3\',\'4\',\'5\') NOT NULL, PRIMARY KEY (sr, survey_date), INDEX (sr))');

// Cheaters srs
        mysql_query('DROP TABLE checksr;');
        mysql_query('CREATE TABLE checksr (sr MEDIUMINT UNSIGNED NOT NULL)');

//log table
        mysql_query('DROP TABLE log');
        mysql_query('CREATE TABLE log (time INT UNSIGNED NOT NULL, ip varchar(20) NOT NULL, host varchar(20) NOT NULL, since INT UNSIGNED NOT NULL, till INT UNSIGNED NOT NULL, type enum(\'L\',\'M\',\'F\') ,req varchar(255))');

        echo 'database recreated. <br><a href=index.php>back to root page</a>';
        ?>
    </body>
</html>